<?php
class Editor {
	
	/**
	 * 初始化编辑器，页面输出前调用
	 */
	public static function init() {
		$view = View::getInstance();
		$view->addHead('<script type="text/javascript" charset="utf-8" src="public/ueditor/editor_config.js"></script>');
		$view->addHead('<script type="text/javascript" charset="utf-8" src="public/ueditor/editor_all_min.js"></script>');
		$view->addHead('<link rel="stylesheet" type="text/css" href="public/ueditor/themes/default/ueditor.css"/>');
	}
	
	/**
	 * 生成一个完整的编辑器
	 */
	public static function full($name, $content, $width = '100%') {
		echo '<script type="text/plain" id="'.$name.'" style="width:'.$width.'">'.$content.'</script>';
		echo '<script type="text/javascript">var editor_'.$name.' = new baidu.editor.ui.Editor(); editor_'.$name.'.render(\''.$name.'\');</script>';
	}
	
	/**
	 * 生成一个简单功能的编辑器
	 */
	public static function simple($name) {
		
	}
}
?>